package com.jjc.android.entity;

import android.text.TextUtils;

import com.google.gson.annotations.SerializedName;

import java.awt.font.TextAttribute;
import java.io.Serializable;

public class LzyResponse<T> implements Serializable {

    public static final int SUCCESS_CODE = 200;

    private static final long serialVersionUID = 5213230387175987834L;

    @SerializedName(value = "code",alternate = {"CEC2C9C8"})
    public int code;
    public String status;
    @SerializedName(value = "msg",alternate = {"err_msg","message"})
    public String msg;
    @SerializedName(value = "data",alternate = {"Data","result"})
    public T data;

    private String image_filename;
    private String img_file_path;

    public int total;

    public String token;

    @Override
    public String toString() {
        return "LzyResponse{\n" +//
               "\tcode=" + code + "\n" +//
               "\tmsg='" + msg + "\'\n" +//
               "\tdata=" + data + "\n" +//
               '}';
    }

    public String getImage_filename() {
        return image_filename;
    }

    public String getImg_file_path() {
        return img_file_path;
    }

    public boolean isOk(){
        if(!TextUtils.isEmpty(img_file_path)){
            return true;
        }else if(!TextUtils.isEmpty(status)){
            return "success".equals(status);
        }else{
            return code == SUCCESS_CODE||code==0;
        }

    }

}
